package de.cwach.svgeditor;

import java.awt.Dimension;
import java.awt.GridLayout;
import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JScrollPane;

public class SVGEdit {

		private static SVGCanvas canvas;
		private static SVGTexteditor editor;
	
	   private static void createAndShowGUI() {
	        //Create and set up the window.
	        JFrame frame = new JFrame("SVG Editor");
	        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	        frame.setLayout(new GridLayout(1, 2));

	        canvas = new SVGCanvas();
	        editor = new SVGTexteditor(canvas);
	        
	        Dimension dim_half = new Dimension(512,768);
	        //Dimension dim_full = new Dimension(1024, 768);
	        
	        canvas.getSwingCanvas().setMinimumSize(dim_half);
	        editor.getEditorSwingComponent().setMinimumSize(dim_half);
	        editor.userDraw();
	        
	        frame.add(canvas.getSwingCanvas());
	        frame.add(new JScrollPane(editor.getEditorSwingComponent()));

	        frame.setSize(new Dimension(1024,768));
	        frame.setMinimumSize(new Dimension(1024,768));
	        
	        frame.pack();
	        frame.setVisible(true);
	        

	    }

	    public static void main(String[] args) {
	        //Schedule a job for the event-dispatching thread:
	        //creating and showing this application's GUI.
	    	
	    	Logger logger = Logger.getLogger("de.cwach.svgeditor");
			logger.setLevel(Level.ALL);
			ConsoleHandler consoleHandler = new ConsoleHandler();
			logger.addHandler(consoleHandler);
			consoleHandler.setLevel(Level.ALL);
			
			
	    	
	        javax.swing.SwingUtilities.invokeLater(new Runnable() {
	            public void run() {
	                createAndShowGUI();
	            }
	        });
	        
	        
			
	        
	    }

	
}
